From f7ee9d5c1c75e3b9a005fc0652c82f92b1e8a2e9 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Mon, 28 Apr 2014 22:23:05 +0000 Subject: [PATCH] work around bug with gbfseek that results in premature eof indications on uncompressed input on the windows platform. --- gpsbabel/gbfile.cc | 2 -- gpsbabel/zlib/README.gpsbabel | 6 +++++- gpsbabel/zlib/gzlib.c | 5 ++++- gpsbabel/zlib/gzlib.patch | 14 ++++++++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 gpsbabel/zlib/gzlib.patch diff --git a/gpsbabel/gbfile.cc b/gpsbabel/gbfile.cc index 1b5d3f542..a5ae1f120 100644 --- a/gpsbabel/gbfile.cc +++ b/gpsbabel/gbfile.cc @@ -21,7 +21,6 @@ */ #include "defs.h" -#include "zlib/zconf.h" #include "gbfile.h" #include @@ -29,7 +28,6 @@ #include #include #include -#include #if __WIN32__ diff --git a/gpsbabel/zlib/README.gpsbabel b/gpsbabel/zlib/README.gpsbabel index b6d1e957c..350f999a6 100644 --- a/gpsbabel/zlib/README.gpsbabel +++ b/gpsbabel/zlib/README.gpsbabel @@ -1 +1,5 @@ -Unmodified wubset of zlib-1.2.8 from zlib.net. +modified subset of zlib-1.2.8 from zlib.net. +1. zconf.h is modified to include our config.h +2. gzlib.c is modified to resolve a seek problem with uncompressed files on windows platforms build with mingw32 gcc. +see gzlib.patch + diff --git a/gpsbabel/zlib/gzlib.c b/gpsbabel/zlib/gzlib.c index fae202ef8..64ca8db37 100644 --- a/gpsbabel/zlib/gzlib.c +++ b/gpsbabel/zlib/gzlib.c @@ -393,7 +393,10 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence) /* if within raw area while reading, just go there */ if (state->mode == GZ_READ && state->how == COPY && state->x.pos + offset >= 0) { - ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); +/* Start GPSBabel local */ +/* ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); */ + ret = LSEEK(state->fd, offset - (z_off64_t)state->x.have, SEEK_CUR); +/* end GPSBabel local */ if (ret == -1) return -1; state->x.have = 0; diff --git a/gpsbabel/zlib/gzlib.patch b/gpsbabel/zlib/gzlib.patch new file mode 100644 index 000000000..7651203bd --- /dev/null +++ b/gpsbabel/zlib/gzlib.patch @@ -0,0 +1,14 @@ +--- gzlib.c 2014-04-28 16:19:19.839086477 -0600 ++++ gzlib.patch.c 2014-04-28 16:18:31.220835104 -0600 +@@ -393,7 +393,10 @@ + /* if within raw area while reading, just go there */ + if (state->mode == GZ_READ && state->how == COPY && + state->x.pos + offset >= 0) { +- ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); ++/* Start GPSBabel local */ ++/* ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); */ ++ ret = LSEEK(state->fd, offset - (z_off64_t)state->x.have, SEEK_CUR); ++/* end GPSBabel local */ + if (ret == -1) + return -1; + state->x.have = 0; -- 2.30.2